/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Winner
 */
@Entity
@Table(name = "tblElevation")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TblElevation.findAll", query = "SELECT t FROM TblElevation t"),
    @NamedQuery(name = "TblElevation.findByElID", query = "SELECT t FROM TblElevation t WHERE t.elID = :elID"),
    @NamedQuery(name = "TblElevation.findByElName", query = "SELECT t FROM TblElevation t WHERE t.elName = :elName"),
    @NamedQuery(name = "TblElevation.findByElCost", query = "SELECT t FROM TblElevation t WHERE t.elCost = :elCost"),
    @NamedQuery(name = "TblElevation.findByElDescription", query = "SELECT t FROM TblElevation t WHERE t.elDescription = :elDescription"),
    @NamedQuery(name = "TblElevation.findByElImage", query = "SELECT t FROM TblElevation t WHERE t.elImage = :elImage"),
    @NamedQuery(name = "TblElevation.findByElStatus", query = "SELECT t FROM TblElevation t WHERE t.elStatus = :elStatus"),
    @NamedQuery(name = "TblElevation.findByEtID", query = "SELECT t FROM TblElevation t WHERE t.etID.etID = :etID")})
public class TblElevation implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "elID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer elID;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "elName")
    private String elName;
    @Basic(optional = false)
    @NotNull
    @Column(name = "elCost")
    private double elCost;
    @Size(max = 500)
    @Column(name = "elDescription")
    private String elDescription;
    @Size(max = 50)
    @Column(name = "elImage")
    private String elImage;
    @Column(name = "elStatus")
    private Boolean elStatus;
    //@JoinClumn: Khai bao thang ma no references đến
    @JoinColumn(name = "etID", referencedColumnName = "etID")
    @ManyToOne
    private TblElevationType etID;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tblElevation")
    private List<TblProjectDetail> tblProjectDetailList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tblElevation")
    private List<TblOrderDetail> tblOrderDetailList;

    public TblElevation() {
    }

    public TblElevation(Integer elID) {
        this.elID = elID;
    }

    public TblElevation(Integer elID, String elName, double elCost) {
        this.elID = elID;
        this.elName = elName;
        this.elCost = elCost;
    }

    public Integer getElID() {
        return elID;
    }

    public void setElID(Integer elID) {
        this.elID = elID;
    }

    public String getElName() {
        return elName;
    }

    public void setElName(String elName) {
        this.elName = elName;
    }

    public double getElCost() {
        return elCost;
    }

    public void setElCost(double elCost) {
        this.elCost = elCost;
    }

    public String getElDescription() {
        return elDescription;
    }

    public void setElDescription(String elDescription) {
        this.elDescription = elDescription;
    }

    public String getElImage() {
        return elImage;
    }

    public void setElImage(String elImage) {
        this.elImage = elImage;
    }

    public Boolean getElStatus() {
        return elStatus;
    }

    public void setElStatus(Boolean elStatus) {
        this.elStatus = elStatus;
    }

    public TblElevationType getEtID() {
        return etID;
    }

    public void setEtID(TblElevationType etID) {
        this.etID = etID;
    }

    @XmlTransient
    public List<TblProjectDetail> getTblProjectDetailList() {
        return tblProjectDetailList;
    }

    public void setTblProjectDetailList(List<TblProjectDetail> tblProjectDetailList) {
        this.tblProjectDetailList = tblProjectDetailList;
    }

    @XmlTransient
    public List<TblOrderDetail> getTblOrderDetailList() {
        return tblOrderDetailList;
    }

    public void setTblOrderDetailList(List<TblOrderDetail> tblOrderDetailList) {
        this.tblOrderDetailList = tblOrderDetailList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (elID != null ? elID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TblElevation)) {
            return false;
        }
        TblElevation other = (TblElevation) object;
        if ((this.elID == null && other.elID != null) || (this.elID != null && !this.elID.equals(other.elID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.getElName();
    }
}
